package com.video.system.service.impl;

import java.util.List;
import com.video.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.video.system.mapper.VideoCommentMapper;
import com.video.system.domain.VideoComment;
import com.video.system.service.IVideoCommentService;
import com.video.common.core.text.Convert;

/**
 * 评论Service业务层处理
 * 
 * @author lyh
 * @date 2021-07-20
 */
@Service
public class VideoCommentServiceImpl implements IVideoCommentService 
{
    @Autowired
    private VideoCommentMapper videoCommentMapper;

    /**
     * 查询评论
     * 
     * @param coId 评论ID
     * @return 评论
     */
    @Override
    public VideoComment selectVideoCommentById(Integer coId)
    {
        return videoCommentMapper.selectVideoCommentById(coId);
    }

    /**
     * 查询评论列表
     * 
     * @param videoComment 评论
     * @return 评论
     */
    @Override
    public List<VideoComment> selectVideoCommentList(VideoComment videoComment)
    {
        return videoCommentMapper.selectVideoCommentList(videoComment);
    }

    /**
     * 新增评论
     * 
     * @param videoComment 评论
     * @return 结果
     */
    @Override
    public int insertVideoComment(VideoComment videoComment)
    {
        videoComment.setCreateTime(DateUtils.getNowDate());
        return videoCommentMapper.insertVideoComment(videoComment);
    }

    /**
     * 修改评论
     * 
     * @param videoComment 评论
     * @return 结果
     */
    @Override
    public int updateVideoComment(VideoComment videoComment)
    {
        videoComment.setUpdateTime(DateUtils.getNowDate());
        return videoCommentMapper.updateVideoComment(videoComment);
    }

    /**
     * 删除评论对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteVideoCommentByIds(String ids)
    {
        return videoCommentMapper.deleteVideoCommentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除评论信息
     * 
     * @param coId 评论ID
     * @return 结果
     */
    @Override
    public int deleteVideoCommentById(Integer coId)
    {
        return videoCommentMapper.deleteVideoCommentById(coId);
    }
}
